home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / Group.java < prev    next >
Text File  |  1998-09-22  |  3KB  |  77 lines

  1. /*
  2.  * @(#)Group.java    1.11 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.security.acl;
  16.  
  17. import java.util.Enumeration;
  18. import java.security.Principal;
  19.  
  20. /**
  21.  * This interface is used to represent a group of principals. (A principal
  22.  * represents an entity such as an individual user or a company). <p>     
  23.  *
  24.  * Note that Group extends Principal. Thus, either a Principal or a Group can 
  25.  * be passed as an argument to methods containing a Principal parameter. For 
  26.  * example, you can add either a Principal or a Group to a Group object by 
  27.  * calling the object's <code>addMember</code> method, passing it the 
  28.  * Principal or Group.
  29.  *
  30.  * @author     Satish Dharmaraj
  31.  */
  32. public interface Group extends Principal {
  33.  
  34.     /**
  35.      * Adds the specified member to the group. 
  36.      *  
  37.      * @param user the principal to add to this group.
  38.      * 
  39.      * @return true if the member was successfully added, 
  40.      * false if the principal was already a member.
  41.      */
  42.     public boolean addMember(Principal user);
  43.  
  44.     /**
  45.      * Removes the specified member from the group.
  46.      * 
  47.      * @param user the principal to remove from this group.
  48.      * 
  49.      * @return true if the principal was removed, or 
  50.      * false if the principal was not a member.
  51.      */
  52.     public boolean removeMember(Principal user);
  53.  
  54.     /**
  55.      * Returns true if the passed principal is a member of the group. 
  56.      * This method does a recursive search, so if a principal belongs to a 
  57.      * group which is a member of this group, true is returned.
  58.      * 
  59.      * @param member the principal whose membership is to be checked.
  60.      * 
  61.      * @return true if the principal is a member of this group, 
  62.      * false otherwise.
  63.      */
  64.     public boolean isMember(Principal member);
  65.  
  66.  
  67.     /**
  68.      * Returns an enumeration of the members in the group.
  69.      * The returned objects can be instances of either Principal 
  70.      * or Group (which is a subclass of Principal).
  71.      * 
  72.      * @return an enumeration of the group members.
  73.      */
  74.     public Enumeration members();
  75.  
  76. }
  77.